package me.algo.array;

/**
 * @author guozheng
 * @date 2024/4/16
 */
public class Jump {
    public static void main(String[] args) {

        int[] nums = {2,5,0,0};

        System.out.println(canJump(nums));
    }


    /**
     * 55. 跳跃游戏
     * @param nums
     * @return
     */
    public static boolean canJump(int[] nums) {
        int len = nums.length;
        int k = 0;
        for (int i = 0; i < len; i++) {
            if (i > k) {
                return false;
            }
            k = Math.max(k, i + nums[i]);
        }
        return false;
    }
}
